<template>
    <view class="context">
        <purchaseTitle ref="purchaseTitle" @setCurPage="setCurPage"></purchaseTitle>

        <!-- 采购 -->
        <view v-show="curPageId == 1">
            <purchaseMenu
                ref="purchaseMenu"
                @loadData="loadData"
                :tabId="curPageId"
            ></purchaseMenu>
            <view class="box">
                <view class="s-h-box">
                    <purchaseHead ref="purchaseHead"></purchaseHead>
                </view>
                <view class="s-c-t-f-box">
                    <purchaseComp ref="purchaseComp"></purchaseComp>
                    <purchaseFlows
                        ref="purchaseFlows"
                        @loadFlowsList="loadFlowsList"
                        @saleBunsinessIncome="saleBunsinessIncome"
                    ></purchaseFlows>
                </view>
            </view>
        </view>

        <!-- 仓库 -->
        <view class="store-v-box" v-show="curPageId == 2">
            <storeList
                :storeList="storeList"
                @clickStore="clickStore"
            ></storeList>
            <storeView
                :storeInfo="storeInfo"
                :list="storeGdCatLs"
                @goStoreDetail="goStoreDetail"
                @goStoreCat="goStoreCat"
                v-show="showStoreGl == 1"
            ></storeView>

            <storeViewGdList
                ref="storeViewGdList"
                v-show="showStoreGl == 2"
                @backStoreView="backStoreView"
            ></storeViewGdList>
        </view>

        <!-- 出库,入库-->
        <view class="store-v-box" v-show="curPageId == 3 || curPageId == 4">
            <view class="i-o-list-box">
                <inOutStoreMenu
                    ref="inOutStoreMenu"
                    @loadData="loadData"
                ></inOutStoreMenu>
                <view class="l-lb-box">
                    <view
                        class="lb-item"
                        v-for="(item, index) in listLbArr"
                        :key="index"
                        >{{ item }}</view
                    >
                </view>
                <div
                    class="l-box comm-list-scroll"
                    v-if="inOutList && inOutList.length > 0"
                    v-infinite-scroll="loadFun"
                >
                    <view
                        class="ls-item"
                        v-for="(item, index) in inOutList"
                        :key="index"
                        @click="clickListItem(item)"
                        :class="
                            curIOItemTime == item.timestr ? 'ls-item-s' : ''
                        "
                    >
                        <view class="i-e">{{ item.timestr }}</view>
                        <view class="i-e">{{ item.amount }}</view>
                        <view class="i-e">{{ item.order_num }}</view>
                        <view class="i-e">{{ item.qty_min }}</view>
                        <text class="icon-font arrow">&#xe600;</text>
                    </view>
                </div>
                <empty v-else />
            </view>

            <!-- 季度出入库 -->
            <view class="m-list-box" v-show="inOutGroup == 3">
                <view class="gd-f-title"
                    >{{ quaTitle }}{{ curPageId == 3 ? "出库" : "入库" }}</view
                >
                <view class="l-lb-box">
                    <view
                        class="lb-item"
                        v-for="(item, index) in listLbArr"
                        :key="index"
                        >{{ item }}</view
                    >
                </view>
                <div
                    class="l-box comm-list-scroll"
                    v-if="monList && monList.length > 0"
                >
                    <view
                        class="ls-item"
                        v-for="(item, index) in monList"
                        :key="index"
                        @click="clickDayListItem(item)"
                        :class="quaTitle == item.timestr ? 'ls-item-s' : ''"
                    >
                        <view class="i-e">{{ item.timestr }}</view>
                        <view class="i-e">{{ item.amount }}</view>
                        <view class="i-e">{{ item.order_num }}</view>
                        <view class="i-e">{{ item.qty_min }}</view>
                        <text class="icon-font arrow">&#xe600;</text>
                    </view>
                </div>
                <empty v-else />
            </view>

            <!-- 月出入库 -->
            <view
                class="d-list-box"
                v-show="inOutGroup == 3 || inOutGroup == 2"
            >
                <view class="gd-f-title"
                    >{{ monTitle }}{{ curPageId == 3 ? "出库" : "入库" }}</view
                >
                <view class="l-lb-box">
                    <view
                        class="lb-item"
                        v-for="(item, index) in listLbArr"
                        :key="index"
                        >{{ item }}</view
                    >
                </view>
                <div
                    class="l-box comm-list-scroll"
                    v-if="dayList && dayList.length > 0"
                >
                    <view
                        class="ls-item"
                        v-for="(item, index) in dayList"
                        :key="index"
                        @click="clickDayItem(item)"
                        :class="monTitle == item.timestr ? 'ls-item-s' : ''"
                    >
                        <view class="i-e">{{ item.timestr }}</view>
                        <view class="i-e">{{ item.amount }}</view>
                        <view class="i-e">{{ item.order_num }}</view>
                        <view class="i-e">{{ item.qty_min }}</view>
                        <text class="icon-font arrow">&#xe600;</text>
                    </view>
                </div>
                <empty v-else />
            </view>

            <!-- 出入库产品列表 -->
            <view
                class="gd-list-box"
                :style="'width:calc(' + gdWidthPer + '% - ' + offSetPer + 'px'"
            >
                <view class="gd-f-title"
                    >{{ curPageId == 3 ? "出库" : "入库" }}流水</view
                >
                <div
                    class="l-box comm-list-scroll"
                    v-if="gdFlowList && gdFlowList.length > 0"
                >
                    <view
                        class="gd-ls-item"
                        v-for="(item, index) in gdFlowList"
                        :key="index"
                    >
                        <view class="ls-item-t">{{ item.day }}</view>
                        <view
                            class="gd-ls-i-ls"
                            v-for="(items, idx) in item.list"
                            :key="idx"
                            @click="getRunningWater(items)"
                        >
                            <image
                                class="g-img"
                                :src="
                                    items.goods_img_small
                                        ? items.goods_img_small
                                        : img_buf
                                "
                            ></image>
                            <view class="is-info-box">
                                <view class="gd-name">{{
                                    items.goods_name
                                }}</view>
                                <view class="gd-b-c-n">
                                    {{
                                        items.brands_name
                                            ? items.brands_name
                                            : ""
                                    }}
                                    {{ items.brands_name ? "|" : "" }}
                                    {{
                                        items.category_name
                                            ? items.category_name
                                            : ""
                                    }}
                                    {{
                                        items.brands_name || items.category_name
                                            ? "|"
                                            : ""
                                    }}
                                    {{ items.item_no ? items.item_no : "" }}
                                </view>
                            </view>
                            <view class="gd-qty">{{ items.qty_min }}</view>
                        </view>
                    </view>
                </div>
                <empty v-else />
            </view>
        </view>

        <!-- 季度流水 -->
        <saleQuarterWin
            ref="saleQuarterWin"
            @saleBunsinessIncome="saleBunsinessIncome"
        ></saleQuarterWin>
        <!-- 月流水 -->
        <saleMoothWin
            ref="saleMoothWin"
            @saleBunsinessIncome="saleBunsinessIncome"
        ></saleMoothWin>
        <!-- 日销售流水 -->
        <saleBusIncomeWin
            ref="saleBusIncomeWin"
            @saleBunsinessIncome="saleBunsinessIncome"
            @loadFun="loadlistFun"
        ></saleBusIncomeWin>
        <!-- 产品流水信息 -->
        <commodityFlowInfo ref="commodityFlowInfo"></commodityFlowInfo>
    </view>
</template>

<script>
import empty from "../../comm/empty.vue";

import purchaseTitle from "./PurchaseTitle.vue";
import purchaseHead from "./PurchaseHead.vue";
import purchaseMenu from "./PurchaseMenu.vue";
import purchaseComp from "./PurchaseComp.vue";
import purchaseFlows from "./PurchaseFlows.vue";
import saleBusIncomeWin from "../../comm/PopSaleBusIncomeWin.vue";
import saleQuarterWin from "../../comm/PopSaleQuarterWin.vue";
import saleMoothWin from "../../comm/PopSaleMoothWin.vue";
import commodityFlowInfo from "../../comm/commodityFlowInfo.vue";

import storeList from "../store/StoreList.vue";
import storeView from "../store/StoreView.vue";
import storeViewGdList from "../store/StoreViewGdList.vue";

import inOutStoreMenu from "../inOutStore/InOutStoreMenu.vue";

import https from "../../../js/https/Https.js";
import staticConst from "../../../js/const/StaticConst.js";
import lang from "../../../js/conf/Lang.js";

const PAGE_SIZE = 20;

export default {
    components: {
        empty,
        purchaseTitle,
        purchaseMenu,
        purchaseHead,
        purchaseComp,
        purchaseFlows,
        saleBusIncomeWin,
        saleMoothWin,
        saleQuarterWin,
        storeList,
        storeView,
        storeViewGdList,
        commodityFlowInfo,
        inOutStoreMenu,
    },
    data() {
        return {
            curPageId: 1, // 1:采购，2：仓库,3：出库,4:入库
            img_buf: staticConst.GOOD_IMG,
            reqStoreCount: {
                storeid: "", //非必须 门店筛选 默认所有
                group: "", //非必须 报表类型 1 日报 2月报 3季报  5 自定义时间的日报 默认按日统计
                stime: "", //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                dtime: "", //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                page: 1, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                uid_cp: "", //成员id
            },

            reqSellList: {
                shopid: "", //非必须 门店筛选 默认所有
                time: "", //非必须 时间筛选  1日 2月 3季 4年 5 自定义  默认为1 此项可不填
                stime: "", //自定义时间 指定查询某一天 格式y-m-d
                pfrom: 0, //非必须 分页参数 - 页面
                pnum: staticConst.PAGE_SIZE, //非必须 分页参数 - 页面显示数量
                uid_cp: "", //成员id
            },

            purchaseFlowsList: [], //存储流水,

            //仓库
            storeList: [],

            storeGdCatLs: [],
            storeInfo: {},

            showStoreGl: 1,

            reqStoreInCount: {
                in_out: 1, //出入库类型，1: 入库，2：出库
                storeid: "", //非必须 门店筛选 默认所有
                group: "", //非必须 报表类型 1 日报 2月报 3季报  5 自定义时间的日报 默认按日统计
                stime: "", //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                dtime: "", //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                page: 1, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
            },
            inList: [], //入库列表
            inPNo: 0, //流水页码

            reqStoreOutCount: {
                in_out: 2, //出入库类型，1: 入库，2：出库
                storeid: "", //非必须 门店筛选 默认所有
                group: "", //非必须 报表类型 1 日报 2月报 3季报  5 自定义时间的日报 默认按日统计
                stime: "", //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                dtime: "", //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                page: 1, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
            },
            outList: [], //出库列表
            outPNo: 0, //流水页码

            listLbArr: [
                lang.dateTxt,
                lang.jeTxt,
                lang.saleReport.oddNumberTxt,
                lang.saleReport.numberTxt,
            ],
            inOutList: [], //出入库列表
            curIOItemTime: "",

            inOutGroup: 1,

            gdWidthPer: 75,
            offSetPer: 12,

            monList: [],
            dayList: [],
            gdFlowList: [],
            quaTitle: "",
            monTitle: "",
            is_soll: false,
            is_listsoll: true,
            ls_data: [],
        };
    },
    methods: {
        initData(tab) {
            this.loadReportShopConut();
            this.getReportStoreCount();
			if(tab)
				this.$refs.purchaseTitle.setCurId(tab);
        },
        loadlistFun() {
            if (this.is_listsoll) return;
            this.reqSellList.pfrom++;
            this.loadSaleData();
        },
        // 滚动加载
        loadFun() {
            if (this.inOutGroup == 2 || this.inOutGroup == 3 || this.is_soll)
                return;
            if (this.curPageId == 3) {
                this.reqStoreOutCount.page++;
            } else {
                this.reqStoreInCount.page++;
            }
            this.getInOutStore();
        },
        // 获取出入库详情
        getRunningWater(item) {
            const data = {
                gdid: item.gdid,
                in_out: this.curPageId == 3 ? "2" : "1",
                page: 0,
                pnum: "20",
                storeid: item.storeid,
                timestr: item.timestr,
            };
            this.$refs.commodityFlowInfo.initData(data);
        },
        loadReportShopConut() {
            let that = this;
            let param = this.reqStoreCount;
            https.getReportPuchaseConut(param, back);
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (!data.data) return;
                    data = data.data;
                    if (data.count_all) {
                        let hData = {};
                        hData.money = data.count_all.amount; //今日销售额
                        hData.salesVolume = data.count_all.number; //销量
                        hData.oddNumber = data.count_all.num_od; //订单数量
                        that.$refs.purchaseHead.setData(
                            hData,
                            that.reqStoreCount
                        );
                    }

                    that.$refs.purchaseMenu.initData(data);
                    that.$refs.inOutStoreMenu.initData(data);

                    if (data.count_ls) {
                        //流水
                        if (
                            that.reqStoreCount.group != 2 &&
                            that.reqStoreCount.group != 3 &&
                            that.reqStoreCount.group != 5
                        ) {
                            that.purchaseFlowsList =
                                that.purchaseFlowsList.concat(data.count_ls);
                            that.reqStoreCount.page++;
                        } else {
                            that.purchaseFlowsList = data.count_ls;
                        }
                        that.$refs.purchaseComp.init(that.purchaseFlowsList);
                        that.$refs.purchaseFlows.initData(
                            that.reqStoreCount.group,
                            that.purchaseFlowsList
                        );
                    }
                }
            }
        },

        loadData(data) {
            this.is_soll = false;
            if (this.curPageId == 1) {
                //采购
                this.purchaseFlowsList = [];
                this.reqStoreCount = {
                    storeid: data.curStore.id,
                    group: data.curTime.id, //非必须 报表类型 1 日报 2月报 3季报  5 自定义时间的日报 默认按日统计
                    stime: data.curTime.st, //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                    dtime: data.curTime.et, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                    page: 1, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                    uid_cp: data.curUcp.id, //成员id
                };
                this.loadReportShopConut();
            } else if (this.curPageId == 3 || this.curPageId == 4) {
                //出入库类型
                this.inOutList = [];
                if (this.curPageId == 3) {
                    this.outList = [];
                    this.reqStoreOutCount = {
                        in_out: 2, //出入库类型，1: 入库，2：出库
                        storeid: data.curStore.id, //非必须 门店筛选 默认所有
                        group: data.curTime.id, //非必须 报表类型 1 日报 2月报 3季报  5 自定义时间的日报 默认按日统计
                        stime: data.curTime.st, //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                        dtime: data.curTime.et, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                        page: 1, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                    };
                    this.inOutGroup = this.reqStoreOutCount.group;
                } else {
                    this.inList = [];
                    this.reqStoreInCount = {
                        in_out: 1, //出入库类型，1: 入库，2：出库
                        storeid: data.curStore.id, //非必须 门店筛选 默认所有
                        group: data.curTime.id, //非必须 报表类型 1 日报 2月报 3季报  5 自定义时间的日报 默认按日统计
                        stime: data.curTime.st, //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                        dtime: data.curTime.et, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                        page: 1, //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                    };
                    this.inOutGroup = this.reqStoreInCount.group;
                }
                this.dayList = [];
                this.monList = [];
                if (this.inOutGroup == 3) {
                    this.gdWidthPer = 25;
                    this.offSetPer = 13;
                } else if (this.inOutGroup == 2) {
                    this.gdWidthPer = 50;
                    this.offSetPer = 13;
                } else {
                    this.gdWidthPer = 75;
                    this.offSetPer = 12;
                }
                this.getInOutStore();
            }
        },

        loadFlowsList() {
            if (
                this.reqStoreCount.group == 2 ||
                this.reqStoreCount.group == 3 ||
                this.reqStoreCount.group == 5
            )
                return;
            this.loadReportShopConut();
        },

        /*****日销售数据列表*****/
        async loadSaleData() {
            let that = this;
            that.is_listsoll = true;
            this.reqSellList.pfrom =
                this.reqSellList.pfrom * this.reqSellList.pnum;
            let param = this.reqSellList;
            await https.getReportPuchaseSellList(param, back);
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (data.data.data) {
                        that.ls_data = that.ls_data.concat(
                            data.data.data[0].order_ls
                        );
                        let obj = {};
                        obj.data = data.data;
                        obj.data.data[0].order_ls = that.ls_data;
                        obj.title = lang.getMD(param.stime);
                        obj.type = 2; //采购
                        that.$refs.saleBusIncomeWin.show("show", obj);
                        setTimeout(() => {
                            that.is_listsoll = false;
                        }, 300);
                    } else {
                        that.is_listsoll = true;
                        that.$msg({ title: "暂无数据" });
                    }
                }
            }
        },

        async saleBunsinessIncome(item, group) {
            if (group == 2 || group == 3) {
                //月.//季度
                this.loadQuatAndMoonFlows(item, group);
            } //其他
            else {
                this.is_listsoll = false;
                this.ls_data = [];
                this.reqSellList.pfrom = 0;
                this.reqSellList = {
                    shopid: this.reqStoreCount.storeid,
                    time: 1, //非必须 时间筛选  1日 2月 3季 4年 5 自定义  默认为1 此项可不填
                    stime: item.timestr, //自定义时间 指定查询某一天 格式y-m-d
                    pfrom: 0, //非必须 分页参数 - 页面
                    pnum: staticConst.PAGE_SIZE, //非必须 分页参数 - 页面显示数量
                    is_yy: 2, //预约板块1是2 否 默认否
                    uid_cp: this.reqStoreCount.uid_cp, //成员id
                };
                await this.loadSaleData();
            }
        },

        async loadQuatAndMoonFlows(item, group) {
            let that = this;
            let param = {};
            param.storeid = this.reqStoreCount.storeid;
            param.group = group;
            if (group == 3) {
                param.group = 2;
            } else if (group == 2) {
                param.group = 1;
            }
            param.stime = item.timestr;
            param.dtime = "";
            param.uid_cp = this.reqStoreCount.uid_cp;
            await https.getReportPuchaseConut(param, back);
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (!data.data) return;
                    data = data.data;
                    let hData = {};
                    if (data.count_all) {
                        hData.amount = data.count_all.amount; //今日销售额
                        hData.number = data.count_all.number; //销量
                        hData.num_od = data.count_all.num_od; //订单数量
                    }

                    let folwList = [];

                    if (data.count_ls) {
                        //流水
                        folwList = data.count_ls;
                    }

                    let obj = {};
                    obj.title = item.time;
                    obj.count = hData;
                    obj.list = folwList;
                    obj.group = param.group;
                    obj.type = 2; //采购
                    if (group == 2) {
                        that.$refs.saleMoothWin.show("show", obj);
                    } else if (group == 3) {
                        that.$refs.saleQuarterWin.show("show", obj);
                    }
                }
            }
        },

        /****采购bar切换*****/
        setCurPage(data) {
            console.log("111");
            this.curPageId = data.id;
            if (this.curPageId == 3 || this.curPageId == 4) {
                this.$refs.inOutStoreMenu.resetTime();
                this.inOutList = [];
                if (this.curPageId == 3) {
                    this.outList = [];
                } else if (this.curPageId == 4) {
                    this.inList = [];
                }
            }
        },

        /*****获取仓库列表******/
        getReportStoreCount() {
            https.getReportStoreCount({}, back);
            let that = this;
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (!data.data) return;
                    that.storeList = data.data;
                    if (that.storeList[1]) {
                        let id = that.storeList[1].store_id;
                        that.clickStore(id);
                    }
                }
            }
        },

        /******点击仓库********/
        clickStore(id) {
            this.showStoreGl = 1;
            https.getReportStoreView({ storeid: id }, back);
            let that = this;
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (!data.data) return;
                    data = data.data;
                    that.storeGdCatLs = data.list;
                    that.storeInfo = data.info;
                }
            }
        },

        /*****仓库详情*****/
        goStoreDetail(data) {},

        /********点击仓库分类*******/
        goStoreCat(data) {
            this.showStoreGl = 2;
            this.$refs.storeViewGdList.getStoreViewListData(data);
        },

        backStoreView() {
            this.showStoreGl = 1;
        },

        /**********出库，入库**********/
        getInOutStore(t) {
            let that = this;
            let param =
                this.curPageId == 3
                    ? this.reqStoreOutCount
                    : this.reqStoreInCount;
            if (this.curPageId == 4) {
                param = this.reqStoreInCount;
            }
            this.is_soll = true;
            https.getReportStoreInOut(param, back);
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (!data.data) {
                        that.is_soll = true;
                    } else {
                        setTimeout(() => {
                            that.is_soll = false;
                        }, 200);
                        data = data.data;
                        if (!t) {
                            if (that.curPageId == 3) {
                                //出入口
                                that.outList = that.outList.concat(data);
                                that.inOutList = that.outList;
                            } else if (that.curPageId == 4) {
                                that.inList = that.inList.concat(data);
                                that.inOutList = that.inList;
                            }
                            if (that.inOutGroup == 3) {
                                if (that.inOutList.length > 0) {
                                    that.clickMonListItem(that.inOutList[0]);
                                    that.curIOItemTime =
                                        that.inOutList[0].timestr;
                                }
                            } else if (that.inOutGroup == 2) {
                                if (that.inOutList.length > 0) {
                                    that.clickDayListItem(that.inOutList[0]);
                                    that.curIOItemTime =
                                        that.inOutList[0].timestr;
                                }
                            } else {
                                if (that.inOutList.length > 0) {
                                    that.clickListItem(that.inOutList[0]);
                                }
                            }
                        } else if (t == 3) {
                            // 季度列表
                            that.monList = that.monList.concat(data);
                            if (that.monList.length > 0) {
                                that.clickDayListItem(that.monList[0]);
                                that.quaTitle = that.monList[0].timestr;
                            }
                        } else if (t == 2) {
                            //月列表
                            that.dayList = that.dayList.concat(data);
                            if (that.dayList.length > 0) {
                                that.gdFlowList = [];
                                that.monTitle = that.dayList[0].timestr;
                                that.getGdFlowList(that.dayList[0]);
                            }
                        }
                    }
                }
            }
        },

        /*****点击列表*****/
        clickListItem(item) {
            if (this.curIOItemTime == item.timestr) return;
            this.curIOItemTime = item.timestr;
            console.log("this.curIOItemTime===:", this.curIOItemTime);
            console.log(item);
            this.monList = [];
            this.dayList = [];
            if (this.inOutGroup == 2) {
                this.monTitle = item.timestr;
                this.clickDayListItem(item);
            } else if (this.inOutGroup == 3) {
                this.quaTitle = item.timestr;
                this.clickMonListItem(item);
            } else {
                this.gdFlowList = [];
                this.getGdFlowList(item);
            }
        },

        //点击季度列表
        clickMonListItem(item) {
            if (this.curPageId == 3) {
                this.reqStoreOutCount.group = 2;
                this.reqStoreOutCount.stime = item.time;
                this.reqStoreOutCount.page = 0;
            } else if (this.curPageId == 4) {
                this.reqStoreInCount.group = 2;
                this.reqStoreInCount.stime = item.time;
                this.reqStoreInCount.page = 0;
            }
            this.getInOutStore(3); //季度列表
        },

        //点击月列表
        clickDayListItem(item) {
            this.quaTitle = item.timestr;
            if (this.curPageId == 3) {
                this.reqStoreOutCount.group = 1;
                this.reqStoreOutCount.stime = item.time;
                this.reqStoreOutCount.page = 0;
            } else if (this.curPageId == 4) {
                this.reqStoreInCount.group = 1;
                this.reqStoreInCount.stime = item.time;
                this.reqStoreInCount.page = 0;
            }
            this.dayList = [];
            this.getInOutStore(2); //季度列表
        },

        clickDayItem(item) {
            this.monTitle = item.timestr;
            if (this.curPageId == 3) {
                this.reqStoreOutCount.group = 1;
                this.reqStoreOutCount.stime = item.time;
                this.reqStoreOutCount.page = 0;
            } else if (this.curPageId == 4) {
                this.reqStoreInCount.group = 1;
                this.reqStoreInCount.stime = item.stime;
                this.reqStoreInCount.page = 0;
            }
            this.gdFlowList = [];
            this.getGdFlowList(item);
        },

        /****出入库流水*****/
        getGdFlowList(item) {
            let that = this;
            let param = {};
            if (this.curPageId == 3) {
                param.in_out = this.reqStoreOutCount.in_out;
                param.storeid = this.reqStoreOutCount.storeid; //非必须 门店筛选 默认所有
                param.stime = item.stime; //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                param.dtime = item.dtime; //分页参数  默认为1 该参数仅为日报时候使用， 其他条件不参与分页
                param.pfrom = this.outPNo * PAGE_SIZE;
            } else {
                param.in_out = this.reqStoreInCount.in_out;
                param.storeid = this.reqStoreInCount.storeid; //非必须 门店筛选 默认所有
                param.stime = item.stime; //非必须 自定义时间统计 开始时间 格式"2020-01-28"
                param.dtime = item.dtime; //分页参
                param.pfrom = this.inPNo * PAGE_SIZE;
            }
            param.pnum = PAGE_SIZE;
            https.getReportStoreInOutGdLs(param, back);
            function back(data) {
                if (!data) return;
                if (data.status == 1) {
                    if (!data.data) return;
                    data = data.data;
                    if (data) {
                        that.gdFlowList = that.gdFlowList.concat(data);
                    }
                }
            }
        },
    },
};
</script>

<style lang="scss">
.context {
    margin-left: 0;
    position: relative;
    width: 100%;//calc(100% - 72px);
    height: 100vh;
    color: #333;
    background-color: #fff;
    .box {
        height: 100%;
        .s-c-t-f-box {
            display: flex;
            height: calc(100vh - 205px);
            position: relative;
            font-size: 14px;
            color: #333;
            .s-c-t-f {
                width: 50%;
                height: 100%;
                // padding: 10px;
                border-right: 1px solid #ededed;
                .s-c-t-box {
                    display: flex;
                    align-items: center;
                    justify-content: space-between;
                }
            }
            .s-f {
                width: 50%;
                border-right: none;
            }
        }
    }

    .gd-f-title {
        height: 40px;
        width: 100%;
        margin-left: -1px;
        border-bottom: 1px #ededed solid;
        border-left: 1px #ededed solid;
        background-color: #fafafafa;
        padding-left: 10px;
        line-height: 40px;
        font-size: 14px;
        font-weight: bold;
    }

    .store-v-box {
        display: flex;
        .i-o-list-box,
        .m-list-box,
        .d-list-box {
            width: 25%;
            height: calc(100vh - 53px);
            border-right: 1px solid #ededed;

            // <view class="i-o-list-box">
            // 	<inOutStoreMenu ref="inOutStoreMenu" @loadData="loadData"></inOutStoreMenu>
            // 	<view class="l-lb-box">
            // 		<view class="lb-item" v-for="(item,index) in listLbArr" :key="index"></view>
            // 	</view>
            // 	<div class="l-box comm-list-scroll">
            // 		<view> </view>
            // 	</div>
            // </view>

            .l-lb-box {
                height: 40px;
                width: 100%;
                display: flex;
                line-height: 40px;
                color: #333;
                border-bottom: 1px solid #fafafa;
                .lb-item {
                    flex: 1;
                    padding-left: 10px;
                    text-align: center;
                }
            }

            .l-box {
                width: 100%;
                height: calc(100% - 82px);
                .ls-item {
                    display: flex;
                    // height:30px;
                    align-items: center;
                    width: 100%;
                    padding: 8px 0;
                    // line-height:30px;
                    color: #333;
                    border-bottom: 1px solid #fafafa;
                    position: relative;
                    cursor: pointer;
                    .i-e {
                        width: 25%;
                        padding-left: 10px;
                        text-align: center;
                    }
                    .arrow {
                        position: absolute;
                        right: 1px;
                    }
                }
                .ls-item:hover {
                    background-color: #eee;
                }
                .ls-item-s {
                    color: #fff;
                    background-color: #3388ff;
                    &:hover {
                        background-color: #3388ff;
                    }
                }
            }
        }

        .gd-list-box {
            height: calc(100vh - 53px);
            .l-box {
                width: 100%;
                height: calc(100% - 41px);
                .gd-ls-item {
                    .ls-item-t {
                        padding-left: 10px;
                        height: 30px;
                        line-height: 30px;
                        width: 100%;
                        background-color: #eee;
                    }
                    .gd-ls-i-ls {
                        display: flex;
                        align-items: center;
                        color: #333;
                        position: relative;
                        margin: 10px;
                        cursor: pointer;
                        .g-img {
                            width: 60px;
                            height: 60px;
                            border-radius: 6px;
                        }
                        .is-info-box {
                            padding-left: 10px;
                            .gd-b-c-n {
                                color: #999;
                            }
                        }
                        .gd-qty {
                            position: absolute;
                            right: 10px;
                            font-weight: bold;
                        }
                    }
                }
            }
        }
    }
}
</style>
